using System;
using System.IO;
using System.Text;
using System.Windows;
using Qplus.beans;
using System.Collections.Generic;

namespace Qplus.Commands
{

    /**
     * 
     *
     */
    public class CreateRoomCommand : AbsHeaderHttpCommand , HttpInputStreamProcessor{

	    const String COMMAND = "CreateRoom";
	
	    private String roomName;
	    private int headType;
	    private String headValue;
	    /**
	     * @param uid
	     * @param UKEY
	     */
	    public CreateRoomCommand(String uid, String UKEY)
            :base(COMMAND,uid,UKEY)
        {
		    
	    }

         /**
	     * @param command
	     * @param uid
	     * @param UKEY
	     */
        public CreateRoomCommand(long uid, byte[] UKEY)
            : base(COMMAND, Convert.ToString(uid), Encoding.UTF8.GetString(UKEY, 0, UKEY.Length))
        {
		    
	    }

	    /**
	     * @param roomName聊天室名称
	     * @param headType聊天室头像类型
	     * @param headValue头像值
	     */
	    public void set(String roomName, int headType, String headValue){
		    setRoomName(roomName);
		    setHeadType(headType);
		    setHeadValue(headValue);
	    }
	
	    private void setRoomName(String name){
		    addParams("RoomName", name);
		    roomName = name;
	    }
	
	    private void setHeadType(int headType){
		    addParams("HeadType", headType);
		    this.headType = headType;
	    }
	
	    private void setHeadValue(String headValue){
		    addParams("HeadValue", headValue);
		    this.headValue = headValue;
	    }
	
	    public HttpTask execute(String url) {
		    return base.execute(url, this);
	    }

	    
	    public override Boolean processInputStream(Stream responseStream) {
            return true;
            
	    }

	    
	    public override void onSuccess(int code) {
	    }

        public override void onFailed(int code)
        {
	    }
	
	    public void onCreateRoom(Room room){
	    }
    }

}
